import sys

if len(sys.argv) != 2:
	print 'input format error!\npython hops_distribution.py query.out'
	sys.exit()

num = 0
hops_distribution = {}

f = file(sys.argv[1])
while True:
	line = f.readline()
	if len(line) == 0:	# Zero length indicates EOF
		break	
	items = line.split()
	hops = items[5].split(":")
	if hops_distribution.has_key(hops[1]) == True:
		hops_distribution[hops[1]] = hops_distribution[hops[1]]+1
	else:
		hops_distribution[hops[1]] = 1
	num = num + 1

f.close()	#close the file

for k, v in hops_distribution.items():
    print '%s\t%f' % (k, float(v)/num)
